import Axios from "@/utils/request.ts";
import {
  UserBindBankCardReq,
  GetUserBankCardByUidRes,
  FxPayCreatOrderRes,
  FxPayCreatOrderReq,
  Arraylist,
  PaymentChannelListRes,
  PaymentOrderRes,
  PaymentOrderRq,
  PaymentInfoRes,
  EpayPaymentMethodsRes,
  UserEpayBankCardListRes,
} from "@/types/wallet.ts";

export const WalletAxios = {
  /***************************钱包***********************************/
  //CPF提现
  fxPayWithdraw(params: { fxfee: number }): Promise<{ code: number }> {
    return Axios.post("/hall/v1/pay/FxPayWithdraw", params);
  },
  //查询绑定的银行卡
  getUserBankCardByUid(params: { paymentMethod: string }): Promise<GetUserBankCardByUidRes> {
    return Axios.post("/hall/v1/pay/getUserBankCardByUid", params);
  },
  //绑定银行卡
  userBindBankCard(params: UserBindBankCardReq) {
    return Axios.post("/hall/v1/pay/userBindBankCard", params);
  },
  //充值
  fxPayCreatOrder(params: FxPayCreatOrderReq): Promise<FxPayCreatOrderRes> {
    return Axios.post("/hall/v1/pay/fxPayCreatOrder", params);
  },
  //充值金额列表
  getRechargeConfigList(): Promise<Arraylist> {
    return Axios.post("/hall/v1/pay/getRechargeConfigList");
  },
  //代收（充值）通道列表
  getRechargePaymentChannelList(): Promise<{ list: PaymentChannelListRes[] }> {
    return Axios.post("/hall/v1/pay/getRechargePaymentChannelList");
  },
  //创建充值订单 - 新支付
  createRechargePaymentOrder(data: {
    currencyAmount: string;
    paymentChannelType: number;
  }): Promise<PaymentOrderRes> {
    return Axios.post("/hall/v1/pay/createRechargePaymentOrder", data);
  },
  //代付（提现）通道列表
  getWithdrawalPaymentChannelList(): Promise<{ list: PaymentChannelListRes[] }> {
    return Axios.post("/hall/v1/pay/getWithdrawalPaymentChannelList");
  },
  //创建提现订单 - 新支付
  createWithdrawalPaymentOrder(params: PaymentOrderRq): Promise<{ code: number; msg: number }> {
    return Axios.post("/hall/v1/pay/createWithdrawalPaymentOrder", params);
  },
  //查询支付信息
  getPaymentInfo(): Promise<{ paymentInfo: PaymentInfoRes }> {
    return Axios.post("/hall/v1/pay/getPaymentInfo");
  },
  //修改银行卡
  updateUserBankCard(params: { paymentMethod: string; receivingAccount: string }) {
    return Axios.post("/hall/v1/pay/updateUserBankCard", params);
  },
  //获取孟加拉支付方式列表
  getEpayPaymentMethods(): Promise<EpayPaymentMethodsRes> {
    return Axios.post("/hall/v1/pay/getEpayPaymentMethods");
  },
  //孟加拉充值订单
  createEpayRechargePaymentOrder(params: {
    bank: string;
    bankCode: string;
    currencyAmount: string;
    giftStatus: number;
  }): Promise<{
    code: number;
    payUrl: string;
    msg: string;
  }> {
    return Axios.post("/hall/v1/pay/createEpayRechargePaymentOrder", params);
  },
  //提现孟加拉绑定银行卡接口
  userBindEpayBankCard(params: {
    openingBank: string;
    openingBankCode: string;
    openingName: string;
    receivingAccount: string;
  }): Promise<{
    code: number;
  }> {
    return Axios.post("/hall/v1/pay/userBindEpayBankCard", params);
  },
  //查询孟加拉用户银行卡列表
  getUserEpayBankCardList(): Promise<{
    code: number;
    data: UserEpayBankCardListRes[];
  }> {
    return Axios.post("/hall/v1/pay/getUserEpayBankCardList");
  },
  //创建孟加拉提现订单
  createEpayWithdrawalPaymentOrder(params: { bankId: number; currencyAmount: string }): Promise<{
    code: number;
    msg: string;
  }> {
    return Axios.post("/hall/v1/pay/createEpayWithdrawalPaymentOrder", params);
  },
};
